#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int add(int a, int b)
{
	return a + b;
}
int jian(int a, int b)
{
	return a - b;
}
int chen(int a, int b)
{
	return a * b;
}
int chu(int a, int b)
{
	return a / b;
}
void menu()
{
	printf("********************\n");
	printf("*****1.加法*********\n");
	printf("*****2.减法*********\n");
	printf("*****3.乘法*********\n");
	printf("*****4.除法*********\n");
	printf("*****4.退出*********\n");
	printf("********************\n");

}
int main()
{
	int input=0;
	int a, b,c;
	int (*pfArr[5])(int, int) = { 0,add,jian,chen,chu };
	do
	{
		menu();
		printf("请选择算法\n");
		scanf("%d", &input);
		if (input >=1 && input <= 4)
		{
			printf("请输入两个操作数\n");
			scanf("%d %d", &a, &b);
			 c = pfArr[input](a, b);
			printf("%d\n", c);
		}
		else
		{
			printf("输入错误,请重新输入");
		}

	} while (input);


	return 0;
}